Image rendering method and apparatus, device, and storage medium

ABSTRACT

An image rendering method includes: acquiring a project scene, materials of an object in the project scene including a light source material, and the light source material being a material that is endowed with a light source attribute by setting a corresponding shading model to be a custom grid light source shading model; searching object grids with the light source material from the project scene, and performing light source structure conversion on the object grids with the light source material to obtain light source grids, the object grids being grids used for forming the object in the project scene; and using each of the light source grids as a light source, to perform direct illumination rendering on each of pixels of the image representing the project scene, and fusing a direct illumination rendering result of each of the light source grids for each of the pixels to obtain a rendered target image.

RELATED APPLICATIONS

This application is a continuation application of PCT Patent ApplicationNo. PCT/CN2022/131698 filed on Nov. 14, 2022, which claims priority toChinese Patent Application No. 2022100907348, entitled “IMAGE RENDERINGMETHOD AND APPARATUS, DEVICE, AND STORAGE MEDIUM” filed with the ChinesePatent Office on Jan. 26, 2022, all of which are incorporated byreference in entirety.

FIELD OF THE TECHNOLOGY

The present disclosure relates to the technical field of imageprocessing, and in particular to an image rendering method andapparatus, a device, and a storage medium.

BACKGROUND

With the development of image processing technologies, an illuminationrendering technology appears. The illumination rendering technology is atechnology to perform illumination rendering on an object in a scene.For example, illumination rendering can be performed on an object in agame scene by using the illumination rendering technology. In certainexisting technology, the influence of the object with a self-luminousmaterial on illumination of the scene is to determine, through indirectillumination, whether reflected light hits the object after reaching thesurface of the object or not, so as to obtain illumination contributionof the self-luminous material to the surface of the object.

However, the indirect illumination solution has met with poorillumination rendering effect on the object in the scene, so that afinally rendered image often comes with unwanted noise and lower imagequality.

SUMMARY

According to various embodiments provided in the present disclosure, animage rendering method and apparatus, a device and a medium areprovided.

In a first aspect, the present disclosure provides an image renderingmethod, executed by a terminal, the method including: acquiring aproject scene, materials of an object in the project scene including alight source material, and the light source material being a materialthat is endowed with a light source attribute by setting a correspondingshading model to be a custom grid light source shading model; searchingobject grids with the light source material from the project scene, andperforming light source structure conversion on the object grids withthe light source material to obtain light source grids, the object gridsbeing grids used for forming the object in the project scene; and usingeach of the light source grids as a light source, to perform directillumination rendering on each of pixels of the image representing theproject scene, and fusing a direct illumination rendering result of eachof the light source grids for each of the pixels to obtain a renderedtarget image.

In a second aspect, the present disclosure provides an image renderingapparatus, the apparatus including: a memory storing computer programinstructions; and a processor coupled to the memory and configured toexecute the computer program instructions and perform: acquiring aproject scene, materials of an object in the project scene including alight source material, and the light source material being a materialthat is endowed with a light source attribute by setting a correspondingshading model to be a custom grid light source shading model; searchingobject grids with the light source material from the project scene, andperforming light source structure conversion on the object grids withthe light source material to obtain light source grids, the object gridsbeing grids used for forming the object in the project scene; and usingeach of the light source grids as a light source, to perform directillumination rendering on each of pixels of the image representing theproject scene, and fusing a direct illumination rendering result of eachof the light source grids for each of the pixels to obtain a renderedtarget image.

In a third aspect, the present disclosure provides a computing device,including a memory and one or more processors, the memory storingcomputer-readable instructions, and when executing the computer-readableinstructions, the processor implementing the steps of the methodsaccording to embodiments of the present disclosure.

In a fourth aspect, the present disclosure provides one or morecomputer-readable storage media, storing computer-readable instructions,the computer-readable instructions, when executed by one or moreprocessors, implementing the steps of the methods according toembodiments of the present disclosure.

In a fifth aspect, the present disclosure provides a computer programproduct, including computer-readable instructions, the computer-readableinstructions, when executed by a processor, implementing the steps ofthe methods according to embodiments of the present disclosure.

Other aspects of the present disclosure may be understood by thoseskilled in the art in light of the description, the claims, and thedrawings of the present disclosure.

Details of one or more embodiments of the present disclosure areprovided in the accompanying drawings and descriptions below. Otherfeatures, objectives, and advantages of the present disclosure becomeapparent from the present disclosure, the drawings, and the claims.

BRIEF DESCRIPTION OF THE DRAWINGS

To facilitate a better understanding of technical solutions of certainembodiments of the present disclosure, accompanying drawings aredescribed below. The accompanying drawings are illustrative of certainembodiments of the present disclosure, and a person of ordinary skill inthe art may still derive other drawings from these accompanying drawingswithout having to exert creative efforts. When the followingdescriptions are made with reference to the accompanying drawings,unless otherwise indicated, same numbers in different accompanyingdrawings may represent same or similar elements. In addition, theaccompanying drawings are not necessarily drawn to scale.

FIG. 1 is a diagram of an implementation environment of an imagerendering method according to certain embodiment(s) of the presentdisclosure;

FIG. 2 is a schematic flowchart of an image rendering method accordingto certain embodiment(s) of the present disclosure;

FIG. 3 is a schematic diagram of an interface for setting a shadingmodel of a material according to certain embodiment(s) of the presentdisclosure;

FIG. 4 is a schematic diagram of a light source grid serving as a lightsource to directly illuminate a scene according to certain embodiment(s)of the present disclosure;

FIG. 5 is a schematic diagram of a light source grid serving as a lightsource to directly illuminate a scene according to certain embodiment(s)of the present disclosure;

FIG. 6 is a schematic diagram of illumination effect comparison betweena direct illumination solution according to certain embodiment(s) of thepresent disclosure and a certain existing indirect illuminationsolution;

FIG. 7 is a schematic diagram of calculating a first texture informationchange rate and a second texture information change rate based on alight source triangular grid according to certain embodiment(s) of thepresent disclosure;

FIG. 8 is a schematic diagram of calculating a first solid angleaccording to certain embodiment(s) of the present disclosure;

FIG. 9 is a schematic diagram of calculating a second solid angleaccording to certain embodiment(s) of the present disclosure;

FIG. 10 is a schematic flowchart of an image rendering method accordingto certain embodiment(s) of the present disclosure;

FIG. 11 is a structural block diagram of an image rendering apparatusaccording to certain embodiment(s) of the present disclosure; and

FIG. 12 is a diagram of an internal structure of a computing deviceaccording to certain embodiment(s) of the present disclosure.

DETAILED DESCRIPTION

To make objectives, technical solutions, and/or advantages of thepresent disclosure more comprehensible, certain embodiments of thepresent disclosure are further elaborated in detail with reference tothe accompanying drawings. The embodiments as described are not to beconstrued as a limitation to the present disclosure. All otherembodiments obtained by a person of ordinary skill in the art withoutcreative efforts shall fall within the protection scope of embodimentsof the present disclosure.

When and as applicable, the term “an embodiment,” “one embodiment,”“some embodiment(s), “some embodiments,” “certain embodiment(s),” or“certain embodiments” may refer to one or more subsets of embodiments.When and as applicable, the term “an embodiment,” “one embodiment,”“some embodiment(s), “some embodiments,” “certain embodiment(s),” or“certain embodiments” may refer to the same subset or different subsetsof embodiments, and may be combined with each other without conflict.

In certain embodiments, the term “based on” is employed hereininterchangeably with the term “according to.”

An image rendering method provided by the present disclosure may beapplied to an implementation environment shown in FIG. 1 . A terminal102 communicates with a server 104 by using a network. The terminal 102may be, but not limited to, various personal computers, notebookcomputers, smart phones, tablet computers, portable wearable devices andvehicle-mounted terminals. The server 104 may be an independent physicalserver, may also be a server cluster or a distributed system composed ofa plurality of physical servers, and may also be a cloud server whichprovides cloud computing services such as cloud services, clouddatabases, cloud computing, cloud functions, cloud storage, networkservices, cloud communications, middleware services, domain nameservices, security services, CDN, and big data and artificialintelligence platforms. The terminal 102 and the server 104 may bedirectly or indirectly connected by wired or wireless communication,which is not limited in the present disclosure.

The terminal 102 may acquire a project scene. Materials of an object inthe project scene includes a light source material. The light sourcematerial is a material that is endowed with a light source attribute bysetting a corresponding shading model to be a custom grid light sourceshading model. The terminal 102 may search object grids with the lightsource material from the project scene, and perform light sourcestructure conversion on the object grids with the light source materialto obtain light source grids. The object grids are grids used forforming the grid of the object in the project scene. The terminal 102may use each of light source grids as a light source, to perform directillumination rendering on each of pixels of the image representing theproject scene, and fuse a direct illumination rendering result of eachof the light source grids for each of the pixels, to obtain a renderedtarget image.

In certain embodiment(s), the term “project scene” refers to ascene-to-be-rendered. Further, an image representing the scene may bereferred to as a project image.

It is to be understood that the server 104 may provide the projectscene, and the terminal 102 may perform illumination rendering on theproject scene provided by the server 104. The terminal 102 may alsoacquire the project scene locally, and perform illumination rendering onthe project scene acquired locally. This embodiment does not limit this,and it is to be understood that the implementation scene in FIG. 1 isonly a schematic illustration and is not limited to this.

In an embodiment, as shown in FIG. 2 , an image rendering method isprovided. The method may be applied to a terminal, executed by theterminal alone, also implemented through interaction between theterminal and the server. This embodiment is described by using anexample in which the method is applied to the terminal 102 in FIG. 1 ,and the method includes the following steps:

Step 202: Acquire a project scene. Materials of an object in the projectscene includes a light source material. The light source material is amaterial that is endowed with a light source attribute by setting acorresponding shading model to be a custom grid light source shadingmodel.

The project scene is an image to be rendered. The materials of theobject refer to a series of parameters and resource for describing thesurface properties of the object, such as at least one of thereflectivity, roughness and self-luminescence of the surface of theobject. The light source material refers to a material with the lightsource attribute, that is, the light source material has the ability toserve as a light source, and can perform direct illumination renderingon a scene. The shading model is a formula used for describing how aspecial material receives and reflects light. The grid light sourceshading model is a shading model used for endowing the material with thelight source attribute, so that the object grid with this material canbe used as a light source. The light source attribute refers to anattribute that can be used as a light source to directly illuminate theobject in the project scene. It is to be understood that only after theshading model of a material is set as a custom grid light source model,the material has the light source attribute, and can perform directillumination rendering on a scene. Therefore, the light source materialis a material that can perform direct illumination rendering throughcustomization, which is a different concept from a self-luminousmaterial that realizes indirect illumination rendering.

In an embodiment, the terminal may acquire scene data-to-be-rendered,and generate a project scene based on the scene data-to-be-rendered.

In an embodiment, a project scene is stored in the server, and theterminal may communicate with the server and acquire the project scenefrom the server.

In an embodiment, as shown in FIG. 3 , the terminal may set the shadingmodel of the certain material as the custom grid light source shadingmodel, that is, various shading models are preset in 301 of FIG. 3 , andthe terminal may set the shading model of this material as the customgrid light source shading model in response to a selection operation forthe grid light source shading model in 301. The terminal may further seta self-luminous color value (as shown in 303) of this material in thegrid light source shading model based on self-luminous color settingoptions in 302. The terminal may further set a texture color for thismaterial based on a texture color setting region 304. 305 shows anillumination effect on this material.

Step 204: Search object grids with the light source material from theproject scene, and perform light source structure conversion on theobject grids with the light source material to obtain light sourcegrids. The object grids are grids used for forming the grid of theobject in the project scene.

Light source structure conversion is a process to convert objectstructures of the object grids into light source structures. The lightsource grids are object grids with the light source attribute. It is tobe understood that the light source grids refer to the object grids thatcan be directly used as light sources to directly illuminate the objectin the project scene.

In certain embodiment(s), the object in the project scene is composed ofmany object grids, and these object grids may include the object gridswith the light source material. The terminal may search the object gridswith the light source material from the numerous object grids in theproject scene. It is to be understood that the terminal may determinethe shading model corresponding to each of the object grids, anddetermine the object grids of which the shading models are the customgrid light source shading models as the object grids with the lightsource material that is to be searched. The terminal may perform lightsource structure conversion on the searched object grids with the lightsource material, to obtain the light source grids.

In an embodiment, the terminal may use each object grid as a searchunit, and determine the material of each of the object grids one by onefrom the numerous object grids in the project scene, so as to search outthe object grids with the light source material.

In an embodiment, the terminal may perform light source structureconversion on the searched object grids with the light source material,to obtain initial light source grids. The terminal may screen out thelight source grids serving as light sources from the initial lightsource grids.

In an embodiment, the terminal may perform light source structureconversion on the searched object grids with the light source material,and directly use the object grids with the light source material afterlight source structure conversion as the light source grids.

In an embodiment, the object grids may be any polygonal object grids,for example, the object grids may be triangular object grids,quadrangular object grids, or pentagonal object grids, and the gridshapes of the object grids are not limited in this embodiment.

Step 206: Use each light source grid as a light source, to performdirect illumination rendering on each of pixels of the imagerepresenting the project scene, and fuse a direct illumination renderingresult of each of the light source grids for each of the pixels toobtain a rendered target image.

Direct illumination refers to an illumination effect that each of thepixels of the image representing the project scene is directlyilluminated by the light source. It is to be understood that directillumination is a process of calculating illumination contributiondirectly from the light source to each of the pixels of the imagerepresenting the project scene. Direct illumination rendering refers toa rendering mode that takes the light source grid as the light source toperform direct illumination calculation on the pixel of the imagerepresenting the project scene. The direct illumination rendering resultrefers to a rendering result obtained by performing image rendering oneach of the pixels of the image in a direct illumination rendering mode.

In certain embodiment(s), the terminal may use each of the light sourcegrids as the light source, to perform direct illumination rendering oneach of the pixels of the image representing the project scene, so as toobtain the direct illumination rendering result of each of the pixels.The terminal may fuse the direct illumination rendering result of eachof the light source grids for each of the pixels, to obtain the renderedtarget image based on the fused direct illumination rendering results.

In an embodiment, as shown in FIG. 4 , the terminal may use a lightsource grid 401 as a light source, to perform direct illuminationrendering on a ground 402 in a project scene. It can be seen from FIG. 4that the light source grid 401 illuminates a part of the ground 402.

In an embodiment, as shown in FIG. 5 , a project scene includes objects501, 502 and 503 with the light source material, the objects 501, 502and 503 each being composed of a plurality of light source grids. Theobjects 501, 502 and 503 may perform direct illumination rendering on ascene through the respective light source grids. For example, 504 inFIG. 5 shows the effect of direct illumination rendering on the ground.

In the image rendering method, the project scene is acquired. Thematerials of the object in the project scene include the light sourcematerial, the light source material being the material that is endowedwith the light source attribute by setting the corresponding shadingmodel to be the custom grid light source shading model. By searching theobject grids with the light source material from the project scene, andperforming light source structure conversion on the object grids withthe light source material, the light source grids that can be directlyused as the light sources can be obtained. By using each of the lightsource grids as the light source, direct illumination rendering can beperformed on each of the pixels of the image representing the projectscene; and by fusing the direct illumination rendering result of each ofthe light source grids for each of the pixels, the rendered target imagecan be obtained. By directly using the light source grid obtainedthrough light source structure conversion as the light source to performdirect illumination rendering on each of the pixels of the imagerepresenting the project scene, the illumination rendering effect of theobject in the scene can be improved, so that the noise of the finallyrendered target image can be reduced, and the image quality can beimproved.

In FIG. 6 , (a) and (b) are illumination effects on the scene realizedby an indirect illumination solution, where the illumination effect in(a) of FIG. 6 has a piece of bright and a piece of dark, and therendered image has a lot of noise. The illumination effect in (b) ofFIG. 6 has many white dots, and the rendered image also has a lot ofnoise. In FIG. 6 , (c) is an illumination effect on the scene realizedby the direct illumination solution of the present disclosure, where theillumination effect in (c) of FIG. 6 is closest to a real illuminationeffect, the rendered target image has less noise, and the image qualityis improved.

In an embodiment, the same object in the project scene includes aplurality of grid regions of the same material. The grid regions of thesame material are regions which are composed of a plurality of adjacentobject grids of the same material in the same object. Searching theobject grids with the light source material from the project scene, andperforming light source structure conversion on the object grids withthe light source material to obtain light source grids includes: search,from the grid regions of the same material in the project scene, thegrid regions of the same material with the light source attribute, toobtain self-luminous grid regions of the same material; each of theobject grids included in the self-luminous grid regions of the samematerial being the object grid of the light source material; and performlight source structure conversion on the object grids of the lightsource material in the self-luminous grid region of the same material,to obtain the light source grids.

The self-luminous grid regions of the same material are grid regions ofthe same material with the light source attribute. It is to beunderstood that the object grids in the same self-luminous grid regionof the same material have the same light source material.

In certain embodiment(s), the project scene includes many objects, andeach object may include a plurality of grid regions of the samematerial, where the plurality of grid regions of the same material mayinclude the grid regions of the same material with the light sourceattribute. The terminal may search the grid regions of the same materialwith the light source attribute from the grid regions of the samematerial in the project scene, and use the searched grid regions of thesame material with the light source attribute as the self-luminous gridregions of the same material. The self-luminous grid region of the samematerial includes a plurality of object grids with the light sourcematerial, and the terminal may perform light source structure conversionon the object grids with the light source material in the self-luminousgrid region of the same material, to obtain the light source grids.

In an embodiment, the terminal may generate a plurality of search tasks,each search task including a plurality of grid regions of the samematerial, one search task corresponding to one search thread, and thesearch threads being processed in parallel. The terminal may search thegrid regions of the same material with the light source attributethrough the search thread corresponding to each of the search tasks, toobtain self-luminous grid regions of the same material.

In an embodiment, the light source grid is a light source triangulargrid, and the terminal may define the light source triangular grid asthe following structure:

 {   Pos; // Pos represents the coordinates of one vertex V0 of thelight source triangular grid   Edge0; // Edge0 represents one edgetaking V0 as the vertex   Edge1; // Edge1 represents the other edgetaking V0 as the vertex   Normal; // Normal represents a normal of thelight source triangular grid   TriangleArea; // TriangleArea representsthe grid area of the light source triangular grid   Radiance; //Radiance represents the radiant illumination information of the lightsource triangular grid  }.

In the embodiment, by first searching the self-luminous grid regions ofthe same material from the grid regions of the same material in theproject scene, and performing light source structure conversion on theobject grids of the light source material in the self-luminous gridregion of the same material, to obtain the light source grids, the speedof searching the object grids with the light source material and theefficiency of generating the light source grids can be improved.

In an embodiment, performing light source structure conversion on theobject grids with the light source material in the self-luminous gridregion of the same material, to obtain the light source grids includes:acquire, for each of the self-luminous grid regions of the samematerial, a calculation scheduling instruction corresponding to theself-luminous grid region of the same material; and enable a calculationshader according to the calculation scheduling instruction, to execute aplurality of threads in the calculation shader, and perform light sourcestructure conversion in parallel on the object grids of the light sourcematerial in the self-luminous grid region of the same material, toobtain the light source grids.

The calculation scheduling instruction is a computer instruction usedfor enabling the calculation shader. The calculation shader is a shaderwith flexible function, used for realizing relatively complex operationson a graphics processing unit (GPU).

In certain embodiment(s), for each self-luminous grid region of the samematerial, the terminal may acquire the calculation schedulinginstruction corresponding to the self-luminous grid region of the samematerial. It is to be understood that one calculation schedulinginstruction is acquired for one self-luminous grid region of the samematerial. The terminal may enable the calculation shader in response tothe calculation scheduling instruction, and the enabled calculationshader may execute the plurality of threads therein, to perform lightsource structure conversion in parallel on the object grids with thelight source material in the self-luminous grid region of the samematerial through the plurality of threads, to obtain the light sourcegrids.

In an embodiment, the quantity of the enabled calculation threads of thecalculation shader may be the same as the quantity of the object gridsin the self-luminous grid region of the same material. It is to beunderstood that one object grid in the self-luminous grid region of thesame material may correspond to one calculation thread, and the objectgrids in the self-luminous grid region of the same material may beprocessed in parallel through the calculation threads.

In the embodiment, light source structure conversion are performed inparallel on the object grids of the light source material in theself-luminous grid region of the same material through the enabledthreads, of which the quantity is the same as the quantity of the objectgrids in the self-luminous grid region of the same material, so that theefficiency of light source structure conversion can be further improved.

In an embodiment, the quantity of the enabled calculation threads of thecalculation shader may be different from the quantity of the objectgrids in the self-luminous grid region of the same material. It is to beunderstood that the plurality of object grids in the self-luminous gridregion of the same material may correspond to one calculation thread,and the object grids in the self-luminous grid region of the samematerial can be processed in parallel through the calculation thread.

In the embodiment, for each of the self-luminous grid regions of thesame material, the calculation shader can be enabled through thecalculation scheduling instruction corresponding to the self-luminousgrid region of the same material; and by executing the plurality ofthreads in the calculation shader, light source structure conversion canbe performed in parallel on the object grids of the light sourcematerial in the self-luminous grid region of the same material, toobtain the light source grids, so that the processing efficiency of theobject grids of the light source material in the self-luminous gridregion of the same material is improved.

In an embodiment, using each of the light source grids as the lightsource, to perform direct illumination rendering on each of the pixelsof the image representing the project scene includes: use each of thelight source grids as the light source, and determine radiantillumination information of the light source grid; and perform, based onthe radiant illumination information of each of the light source grids,direct illumination rendering on each of the pixels of the imagerepresenting the project scene;

The radiant illumination information is illumination informationradiated by the light source grid as the light source.

In certain embodiment(s), the terminal may use each of the light sourcegrids as the light source. For each of the light source grids as thelight source, the terminal may determine the radiant illuminationinformation of the light source grid. The terminal may perform, based onthe radiant illumination information of each of the light source grids,direct illumination rendering on each of the pixels of the imagerepresenting the project scene.

In the embodiment, each of the light source grids is used as the lightsource, and the radiant illumination information of the light sourcegrid can be determined; and based on the radiant illuminationinformation of each of the light source grids, direct illuminationrendering can be performed on each of the pixels of the imagerepresenting the project scene, so that the illumination renderingeffect of each of the pixels of the image representing the project scenecan be improved.

In an embodiment, the radiant illumination information includes aradiant color value. Determining the radiant illumination information ofthe light source grid includes: in response to that the light sourcegrid is a solid color light source grid, use a self-luminous color valuecorresponding to the solid color light source grid as the radiant colorvalue of the solid color light source grid; the self-luminous colorvalue being a color value preset in a grid light source shading modelcorresponding to the solid color light source grid.

The radiant color value is a color value radiated by the light sourcegrid as the light source. The solid light source grid is the lightsource grid including a single color. It is to be understood that thecolor values of the pixels in the solid color light source grid are thesame.

In certain embodiment(s), in response to that the light source grid isthe solid color light source grid, the terminal may determine theself-luminous color value corresponding to the solid color light sourcegrid, and directly use the self-luminous color value corresponding tothe solid color light source grid as the radiant color value of thesolid color light source grid.

In an embodiment, the terminal may set a color value in a grid lightsource shading model of the light source grid. As shown in FIG. 1 , theself-luminous color value, corresponding to the solid color light sourcegrid, set in 303 can be directly used as the radiant color value of thesolid color light source grid.

In the embodiment, in response to that the light source grid is thesolid color light source grid, the self-luminous color valuecorresponding to the solid color light source grid is directly used asthe radiant color value of the solid color light source grid, so thatthe calculation speed of the radiant color value of the solid colorlight source grid can be improved.

In an embodiment, the radiant illumination information includes aradiant color value. Determining the radiant illumination information ofthe light source grid includes: in response to that the light sourcegrid is a texture light source grid, determine an average color value oftexture colors in the texture light source grid, to obtain the radiantcolor value of the texture light source grid.

The texture source grid is the light source grid with textures. It is tobe understood that the color values of the pixels in the texture lightsource grid may be different.

In certain embodiment(s), in response to that the light source grid isthe texture light source grid, the terminal may determine the averagecolor value of the texture colors in the texture light source grid. Itis to be understood that the terminal may determine the color value ofeach of the pixels in the texture light source grid, and average thecolor values of the pixels in the texture light source grid to obtainthe average color value of the texture colors. The terminal may directlyuse the average color value of the texture colors in the texture lightsource grid as the radiant color value of the texture light source grid.

In the embodiment, in response to that the light source grid is thetexture light source grid, the average color value of the texture colorsin the texture light source grid can be determined, and the averagecolor value is used as the radiant color value of the texture lightsource grid, so that the calculation speed of the radiant color value ofthe texture light source grid can be improved.

In an embodiment, in response to that the light source grid is thetexture light source triangular grid, determining the average colorvalue of the texture colors in the texture light source triangular grid,to obtain the radiant color value of the texture light source triangulargrid includes: in response to that the light source grid is the texturelight source triangular grid, determine the length of each of the edgesin the texture light source triangular grid; determine the length of theshortest edge in the texture light source triangular grid, and determinea first texture information change rate of the texture light sourcetriangular grid in a texture space; determine, according to thecorresponding lengths of the two long edges of the texture light sourcetriangular grid, a second texture information change rate of the texturelight source triangular grid in the texture space; the two long edgesbeing two edges except the shortest edge of the texture light sourcetriangular grid; and determine, according to the first textureinformation change rate and the second texture information change ratecorresponding to the texture light source triangular grid, the averagecolor value of the texture colors in the texture light source triangulargrid, to obtain the radiant color value of the texture light sourcetriangular grid.

The texture light source triangular grid is a triangular texture lightsource grid. The shortest edge refers to the edge with the shortestlength of the texture light source triangular grid. The textureinformation change rate is used for representing the change of textureinformation of the texture light source triangular grid. The firsttexture information change rate is the texture information change rateobtained based on the length of the shortest edge of the texture lightsource triangular grid. The second texture information change rate isthe texture information change rate obtained based on the correspondinglengths of the two long edges of the texture light source triangulargrid.

In certain embodiment(s), in response to that the light source grids arethe texture light source triangular grids, for each of texture lightsource triangular grids, the terminal may determine the length of eachof edges of the texture light source triangular grid. It is to beunderstood that the terminal may determine the length of the shortestedge of the texture light source triangular grid, and the correspondinglengths of the two long edges of the texture light source triangulargrid. The terminal may calculate, according to the length of theshortest edge of the texture light source triangular grid, the firsttexture information change rate of the texture light source triangulargrid in the texture space, and calculate, according to the correspondinglengths of the two long edges of the texture light source triangulargrid, the second texture information change rate of the texture lightsource triangular grid in the texture space. The terminal may calculate,according to the first texture information change rate and the secondtexture information change rate corresponding to the texture lightsource triangular grid, the average color value of the texture colors inthe texture light source triangular grid, and directly use thecalculated average color value as the radiant color value of the texturelight source triangular grid.

In an embodiment, the terminal may use the first texture informationchange rate and the second texture information change rate correspondingto the texture light source triangular grid as parameters of a leveldetermination function, to obtain a corresponding level of texturemapping. The terminal may use a texture color value corresponding to thelevel of the texture mapping (Mipmao) as the average color value of thetexture colors in the texture light source triangular grid, and directlyuse the average color value as the radiant color value of the texturelight source triangular grid. The level determination function is afunction that is pre-built and used for determining the level of thetexture mapping.

In the embodiment, by using the first texture information change rateand the second texture information change rate corresponding to thetexture light source triangular grid as the parameters of the leveldetermination function, the corresponding level of the texture mappingcan be obtained, and the texture color value corresponding to the levelof the texture mapping is directly used as the average color value ofthe texture colors in the texture light source triangular grid, so thatthe calculation efficiency of the average color value can be improved.

In an embodiment, as shown in FIG. 7 , the terminal may determine thelength of the shortest edge of a texture light source triangular grid701, and the corresponding lengths of a long edge b and a long edge c ofthe texture light source triangular grid 701. The terminal maycalculate, according to the length of the shortest edge e of the texturelight source triangular grid 701, a first texture information changerate e of the texture light source triangular grid 701 in a texturespace, and calculate, according to the corresponding lengths of the twolong edges b and c of the texture light source triangular grid 701, asecond texture information change rate d of the texture light sourcetriangular grid 701 in the texture space. It is to be understood thatthe length of a short axis of an inscribed ellipse in the texture lightsource triangular grid 701 is the first texture information change ratee, and the length of a long axis of the inscribed ellipse in the texturelight source triangular grid 701 is the second texture informationchange rate d.

In an embodiment, the terminal may use the ratio of the length of theshortest edge of the texture light source triangular grid to a firstpreset constant as the first texture information change rate of thetexture light source triangular grid in the texture space. The terminalmay sum up the corresponding lengths of the two long edges of thetexture light source triangular grid, and use the ratio of the sumresult to a second preset constant as the second texture informationchange rate of the texture light source triangular grid in the texturespace.

In an embodiment, the first texture information change rate of thetexture light source triangular grid in the texture space may becalculated by using the following formula:

ShortGradient=ShortEdge*(2.0/3.0)

The second texture information change rate of the texture light sourcetriangular grid in the texture space may be calculated by using thefollowing formula:

LongGradient=(LongEdge1+LongEdge2)/3.0

where ShortGradient represents the first texture information changerate, ShortEdge represents the length of the shortest edge of thetexture light source triangular grid, LongGradient represents the secondtexture information change rate, LongEdge1 and LongEdge2 represent thecorresponding lengths of the two long edges of the texture light sourcetriangular grid respectively, and 2.0 and 3.0 are the preset constants.

In the embodiment, based on the length of the shortest edge of thetexture light source triangular grid, the first texture informationchange rate of the texture light source triangular grid in the texturespace can be rapidly determined, and based on the corresponding lengthsof the two long edges of the texture light source triangular grid, thesecond texture information change rate of the texture light sourcetriangular grid in the texture space can be rapidly determined.According to the first texture information change rate and the secondtexture information change rate corresponding to the texture lightsource triangular grid, the radiant color value of the texture lightsource triangular grid can be rapidly determined, so that thecalculation speed of the radiant color value of the texture light sourcetriangular grid is improved.

In an embodiment, performing light source structure conversion on theobject grids of the light source material to obtain the light sourcegrids includes: perform light source structure conversion on the objectgrids of the light source material, to obtain initial light sourcegrids; determine the grid areas and the radiant illumination informationof the initial light source grids; determine, for each of the initiallight source grids, luminous flux of the initial light source grid,according to the grid area and the radiant illumination information ofthe initial light source grid; and sample, according to the luminousflux of the initial light source grids, the initial light source gridsto obtain the light source grids;

The luminous flux is light emitted by the initial light source grid as alight source in unit time. It is to be understood that the larger theluminous flux of the initial light source grid, the greater illuminationcontribution to each of the pixels of the image representing the projectscene, and otherwise the smaller it is.

In certain embodiment(s), the terminal may perform light sourcestructure conversion on the object grids of the light source material,to obtain the initial light source grids. The terminal may determine thegrid area and the radiant illumination information of each of theinitial light source grids. For each of the initial light source grids,the terminal may calculate the luminous flux of the initial light sourcegrid according to the grid area and the radiant illumination informationof the initial light source grid, and sample the initial light sourcegrids according to the luminous flux of the initial light source gridsto obtain the light source grids. It is to be understood that the lightsource grid with larger luminous flux is easier to be sampled. Based onthe luminous flux, a part of the initial light source grids which havemore illumination contribution to each of the pixels of the imagerepresenting the project scene are selected as the light source gridsfor subsequent direct illumination calculation.

In an embodiment, the radiant illumination information includes aradiant color value. The terminal may multiply the grid area of theinitial light source grid by the radiant color value of the initiallight source grid, and multiply the multiplying result by Pi, to obtainthe luminous flux of the initial light source grid.

In an embodiment, the luminous flux of the initial light source grid maybe calculated by using the following formula:

Flux=SurfaceArea*EmissiveColor*Pi

where Flux represents the luminous flux of the initial light sourcegrid, SurfaceArea represents the grid area of the initial light sourcegrid, EmissiveColor represents the radiant color value of the initiallight source grid, and Pi represents the ratio of the circumference of acircle to its diameter.

In the embodiment, by performing light source structure conversion onthe object grids of the light source material, the initial light sourcegrids can be obtained, and the light source grids are obtained bysampling the initial light source grids according to the luminous fluxof the initial light source grids, so that the noise of the finallyrendered target image can be further reduced, and the image quality canbe improved.

In an embodiment, performing direct illumination rendering on each ofthe pixels of the image representing the project scene based on theradiant illumination information of each of the light source gridsincludes: determine, for each of the light source grids, a directillumination contribution value of the light source grid to each of thepixels of the image representing the project scene; and determine,according to the direct illumination contribution value and the radiantillumination information, a rendering illumination value contributed bythe light source grid to each of the pixels of the image representingthe project scene. Fusing the direct illumination rendering result ofeach of the light source grids for each of the pixels to obtain therendered target image includes: fuse the rendering illumination value ofeach of the light source grids for each of the pixels, to obtain therendered target image.

The direct illumination contribution value is an illumination weightvalue contributed through direct illumination on each of the pixels ofthe image representing the project scene by the light source grid as thelight source. The rendering illumination value is an illumination valuethat each of the pixels of the image representing the project scenefinally receives from the light source grid and is used for illuminationrendering. It is to be understood that the illumination valuecorresponding to the radiant illumination information generated by thelight source grid as the light source is not equal to the renderingillumination value finally received by each of the pixels of the imagerepresenting the project scene. Because there is some illuminationattenuation in an illumination process, the rendering illumination valuefinally received by each of the pixels of the image representing theproject scene is generally less than the illumination valuecorresponding to the radiant illumination information generated by thelight source grid.

In certain embodiment(s), for each of the light source grids, theterminal may determine the direct illumination contribution value of thelight source grid to each of the pixels of the image representing theproject scene, and calculate, according to the direct illuminationcontribution value and the radiant illumination information, therendering illumination value contributed by the light source grid toeach of the pixels of the image representing the project scene. Theterminal may fuse the rendering illumination value of each of the lightsource grids for each of the pixels, to obtain the rendered targetimage.

In the embodiment, based on the direct illumination contribution valueof the light source grid to each of the pixels of the image representingthe project scene and the radiant illumination information of the lightsource grid, the rendering illumination value contributed to each of thepixels of the image representing the project scene can be determined,and by fusing the rendering illumination value of each of the lightsource grids for each of the pixels, the rendered target image can beobtained, so that the illumination rendering effect of each of thepixels of the image representing the project scene can be improved, andthus the image quality is further improved.

In an embodiment, determining, for each of the light source grids, thedirect illumination contribution value of the light source grid to eachof the pixels of the image representing the project scene includes:sample, for each of the light source grids, points in the light sourcegrid according to a probability density distribution function, to obtainsampling points in the light source grid; determine, for each of thepixels of the image representing the project scene, a first contributioncoefficient of each of the sampling points relative to the pixelaccording to location information corresponding to each of the samplingpoints and location information of a camera; determine, according to theincluded angle between incident light of each of the sampling points tothe pixel and a normal of the pixel, a second contribution coefficientof each of the sampling points relative to the pixel; determine,according to a probability density distribution function value forsampling each of the sampling points, a third contribution coefficientof each of the sampling points relative to the pixel; and determine,according to the first contribution coefficient, the second contributioncoefficient and the third contribution coefficient of each of thesampling points relative to the pixel, the direct illuminationcontribution value of the light source grid to the pixel in the projectscene.

The probability density distribution function is used for representingrandom sampling on the points in the light source grid. The samplingpoints are points obtained by sampling from the light source grid. Thefirst contribution coefficient is a contribution coefficient determinedbased on the location information corresponding to each of the samplingpoints and the location information of the camera. The secondcontribution coefficient is a contribution coefficient determined basedon the included angle between the incident light of each of the samplingpoints to the pixel and the normal of the pixel. The incident lightrefers to light emitted from the sampling point and finally incident tothe pixel in the project scene. The probability density distributionfunction value is a probability value that each of the sampling pointsis randomly sampled while sampling is performed on the points in thelight source grid according to the probability density distributionfunction. The third contribution coefficient is a contributioncoefficient determined based on the probability density distributionfunction value of each of the sampling points. The location informationof the camera refers to the location information of the camera relativeto each of the pixels of the image representing the project scene.

In certain embodiment(s), for each of the light source grids, theterminal may randomly sample the points in the light source gridaccording to the preset probability density distribution function, toobtain the sampling points in the light source grid. For each of thepixels of the image representing the project scene, the locationinformation corresponding to each of the sampling points and thelocation information of the camera are determined, and the firstcontribution coefficient of each of the sampling points relative to thepixel is calculated according to the location information correspondingto each of the sampling points and the location information of thecamera. The terminal may determine the included angle between theincident light of each of the sampling points to the pixel and thenormal of the pixel, and calculate, according to the included anglebetween the incident light of each of the sampling points to the pixeland the normal of the pixel, the second contribution coefficient of eachof the sampling points relative to the pixel. The terminal may determinethe probability density distribution function value for sampling each ofthe sampling points, and calculate, according to the probability densitydistribution function value for sampling each of the sampling points,the third contribution coefficient of each of the sampling pointsrelative to the pixel. The terminal may determine, according to thefirst contribution coefficient, the second contribution coefficient andthe third contribution coefficient of each of the sampling pointsrelative to the pixel, the direct illumination contribution value of thelight source grid to the pixel in the project scene.

In an embodiment, the present disclosure provides a calculation methodfor the rendering illumination value of the pixel, the calculationmethod has a rendering equation as follows:

∫ L i ( l ) ⁢ f ⁡ ( l , v ) ⁢ cos ⁢ θ l ⁢ dl ≈ 1 N ⁢ ∑ k = 1 N L i ( l k ) ⁢ f ⁡( l k , v ) ⁢ cos ⁢ θ l k p ⁡ ( l k , v )

-   -   where ∫L_(i)(l)f(l,v)cos θ_(l)dl represents the rendering        illumination value finally received by the pixel, N represents        the quantity of all the sampling points obtained by sampling        from the light source grid, L_(i)(l_(k)) represents the radiant        illumination information of the incident light l_(k) emitted by        a k^(th) sampling point, v represents the coordinates of the        camera, θ_(l) _(k) represents the included angle between the        incident light l_(k) and the normal of the pixel, f(l_(k), v) is        a bidirectional reflection distribution function, used for        describing the intensity and direction of the light reflection        after the incident light l_(k) irradiates the pixel (that is the        object), p(l_(f), v) represents the probability density        distribution function value of the incident light l_(k), when        the coordinates of the camera are v.

It is to be understood that f(l_(k), v) is the first contributioncoefficient, cos θ_(l) _(k) is the second contribution coefficient, andp(l_(k), v) is the third contribution coefficient.

In the embodiment, the sampling points in the light source grid can beobtained by sampling the points in the light source grid through theprobability density distribution function; the first contributioncoefficient of each of the sampling points relative to the pixel can bedetermined according to the location information corresponding to eachof the sampling points and the location information of the camera; thesecond contribution coefficient of each of the sampling points relativeto the pixel can be determined according to the included angle betweenthe incident light of each of the sampling points to the pixel and thenormal of the pixel; and the third contribution coefficient of each ofthe sampling points relative to the pixel can be determined according tothe probability density distribution function value used for samplingthe sampling point. The direct illumination contribution value of thelight source grid to the pixel in the project scene can be determinedaccording to the first contribution coefficient, the second contributioncoefficient and the third contribution coefficient of each of thesampling points relative to the pixel, so that the calculation accuracyof the direct illumination contribution value is improved, and theillumination effect is further improved.

In an embodiment, determining, according to the probability densitydistribution function value for sampling each of the sampling points,the third contribution coefficient of the sampling point relative to thepixel includes: determine, for each of the light source grids, thecenter of gravity and the grid area of the light source grid; determine,for each of the pixels of the image representing the project scene, adistance between the center of gravity of the light source grid and thepixel in the project scene; determine, based on the distance and thegrid area of the light source grid, a first solid angle of the lightsource grid relative to the pixel; and determine, according to the firstsolid angle, the probability density distribution function value forsampling each of the sampling points, and use the probability densitydistribution function value for sampling each of the sampling points asthe third contribution coefficient of the sampling point relative to thepixel.

The solid angle is an angle of the light source grid to athree-dimensional space of a pixel. It is to be understood that thesolid angle is the analogy of a plane angle in the three-dimensionalspace. The first solid angle is a solid angle determined based on thedistance between the center of gravity of the light source grid and thepixel in the project scene, as well as the grid area of the light sourcegrid.

In certain embodiment(s), for each of the light source grids, theterminal may determine the center of gravity and the grid area of thelight source grid. For each of the pixels of the image representing theproject scene, the terminal may determine the distance between thecenter of gravity of the light source grid and the pixel in the projectscene. The terminal may calculate, based on the distance and the gridarea of the light source grid, the first solid angle of the light sourcegrid relative to the pixel. The terminal may calculate, according to thefirst solid angle, the probability density distribution function valuefor sampling each of the sampling points, and directly use theprobability density distribution function value for sampling each of thesampling points as the third contribution coefficient of the samplingpoint relative to the pixel.

In an embodiment, the terminal may directly use the reciprocal of thefirst solid angle as the probability density distribution function valuefor sampling each of the sampling points.

In an embodiment, as shown in FIG. 8 , for a pixel Q, the terminal maydetermine a distance L between the center of gravity P of a light sourcegrid 801 and the pixel Q in a project scene. The terminal may calculate,based on the distance L and the grid area of the light source grid 801,a first solid angle β1 of the light source grid 801 relative to thepixel Q.

In an embodiment, the terminal may calculate the square of the distancebetween the center of gravity of the light source grid and the pixel inthe project scene, to obtain a squared result. The terminal may take theratio of the grid area of the light source grid to the squared result asthe first solid angle of the light source grid relative to the pixel.

In an embodiment, the first solid angle of the light source gridrelative to the pixel may be estimated by using the following formula:

SolidAngle≈TriangleArea/(Distance*Distance)

where SolidAngle represents the first solid angle (that is (31) of thelight source grid relative to the pixel, TriangleArea represents thegrid area of the light source grid, and Distance represents the distance(that is L) between the center of gravity of the light source grid andthe pixel in the project scene.

In an embodiment, for each of the light source grids, the terminal maydetermine a normal vector of the light source grid. For each of thepixels of the image representing the project scene, the terminal maydetermine a normal vector of the pixel. The terminal may determine,according to the included angle between the normal vector of the lightsource grid and the normal vector of the pixel, the orientation of thelight source grid relative to the pixel. If the orientation is forward,the step of determining, according to the first solid angle, theprobability density distribution function value for sampling each of thesampling points is executed. If the orientation is backward, it meansthat the light source grid has no illumination contribution to thepixel.

In the embodiment, the first solid angle of the light source gridrelative to the pixel can be rapidly determined based on the distancebetween the center of gravity of the light source grid and the pixel inthe project scene, as well as the grid area of the light source grid.According to the first solid angle, the probability density distributionfunction value for sampling each of the sampling points can be rapidlydetermined, and the probability density distribution function value forsampling each of the sampling points can be directly used as the thirdcontribution coefficient of the sampling point relative to the pixel, sothat the calculation speed of the third contribution coefficient isimproved.

In an embodiment, determining, for each of the light source grids, thedirect illumination contribution value of the light source grid to eachof the pixels of the image representing the project scene includes:determine, for each of the pixels of the image representing the projectscene, a vector of each of edges formed by the pixel and each ofvertexes of the light source grid; determine, according to the vector ofeach of the edges, a normal vector of each of the planes, where thepixel is located, of a polygonal pyramid formed by the pixel and thevertexes of the light source grid; determine, according to the normalvector of each of the planes where the pixel is located, a second solidangle of the light source grid relative to the pixel; and use the secondsolid angle as the direct illumination contribution value of the lightsource grid to the pixel in the project scene.

The second solid angle is a solid angle determined based on the normalvector of each of the planes where the pixel is located.

In certain embodiment(s), the pixel and the vertexes of the light sourcegrid may be connected to form the polygonal pyramid. For each of thepixels of the image representing the project scene, the terminal maydetermine the vector of each of the edges formed by the pixel and eachof the vertexes of the light source grid. The terminal may determine,according to the vector of each of the edges formed by the pixel andeach of the vertexes of the light source grid, the normal vector of eachof the planes, where the pixel is located, of the polygonal pyramidformed by the pixel and the vertexes of the light source grid. Theterminal may determine, according to the normal vector of each of theplanes where the pixel is located, the second solid angle of the lightsource grid relative to the pixel, and directly use the second solidangle as the direct illumination contribution value of the light sourcegrid to the pixel in the project scene.

In an embodiment, the present disclosure provides another calculationmethod for the rendering illumination value of the pixel, thecalculation method has a rendering equation as follows:

${\frac{1}{N}{\sum\limits_{k = 1}^{N}\frac{{L_{i}\left( l_{k} \right)}{f\left( {l_{k},v} \right)}\cos\theta_{l_{k}}}{p\left( {l_{k},v} \right)}}} \approx {\left( {\frac{1}{N}{\sum\limits_{k = 1}^{N}{L_{i}\left( l_{k} \right)}}} \right)\left( {\frac{1}{N}{\sum\limits_{k = 1}^{N}\frac{{f\left( {l_{k},v} \right)}\cos\theta_{l_{k}}}{\left. {p\left\langle {l_{k},v} \right.} \right)}}} \right)}$where$\left( {\frac{1}{1V}{\sum\limits_{k = 1}^{N}{L_{i}\left( l_{k} \right)}}} \right)$

represents the integration of the directions of all the incident lightl_(k). It is to be understood that the value of the second solid angleis equal to

$\left( {\frac{1}{N}{\sum\limits_{k = 1}^{N}{L_{i}\left( l_{k} \right)}}} \right),{and}$$\left( {\frac{1}{N}{\sum\limits_{k = 1}^{N}\frac{{f\left( {l_{k},v} \right)}\cos\theta_{l_{k}}}{p\left( {l_{k},v} \right)}}} \right)$

is a constant pre-calculated by the terminal and stored locally. Whenthe terminal performs direct illumination rendering on the pixel in theproject scene, the constant can be directly used. It is to be understoodthat the terminal may use

$\left( {\frac{1}{N}{\sum\limits_{k = 1}^{N}{L_{i}\left( l_{k} \right)}}} \right)$

as the direct illumination contribution value, and calculate, based onthe direct illumination contribution value and the radiant illuminationinformation of the light source grid, the rendering illumination valuecontributed by the light source grid to the pixel in the project scene.

In an embodiment, as shown in FIG. 9 , a light source grid 901 is alight source triangular grid. In a polygonal pyramid formed by a pixel Oand the vertexes (that is A, B and C) of a light source grid 901, theterminal may determine normal vectors of three planes (that is OAB, OACand OBC) where the pixel O is located. The terminal may determine theincluded angles between any two normal vectors in the normal vectors ofthe three planes, and add the obtained three included angles. Theterminal may use the difference between the result of adding the threeincluded angles and Pi as a second solid angle β2 of the light sourcegrid relative to the pixel.

For example, as shown in FIG. 9 , the light source grid 901 is the lightsource triangular grid, and the terminal may use the location of thevertex A in the light source grid 901 as the location of the lightsource grid 901. The terminal may calculate, based on the location ofthe vertex A and vectors of two edges connected to the vertex A, vectorsof the three vertexes of the light source grid 901. The vectors of thethree vertexes of the light source grid 901 may be calculated by usingthe following formulas:

OA=Triangle·Pos;

OB=Triangle·Pos+Triangle·Edge0;

OC=Triangle·Pos+Triangle·Edge1;

where OA, OB and OC represent the vectors between the pixel O and thethree vertexes A, B and C respectively, Triangle.Pos represents thevector of the vertex A in the light source grid, and Triangle.Edge0 andTriangle.Edge1 represent the vectors of two edges connected to thevertex A.

The terminal may perform pairwise cross multiplication on the OA, OB andOC vectors, and calculate the normal vectors of the three planes OAC,OAB and OBC. The normal vectors of the three planes OAC, OAB and OBC maybe calculated by using the following formulas:

n0=normalize(cross(OB,OA));

n1=normalize(cross(OA,OC));

n2=normalize(cross(OC,OB));

where n0, n1 and n2 represent the normal vectors of the three planesOAB, OAC and OBC respectively, cross( ) represents performing pairwisecross multiplication on the normal vectors, normalize( ) representsperforming normalization.

The terminal may calculate the included angles between any two of thenormal vectors n0, n1 and n2. It is to be understood that the includedangles are equal to the included angles between the planes OAB, OAC andOBC. The included angles between any two of the normal vectors n0, n1and n2 may be calculated by using the following formulas:

angle0=a cos(−dot(n0,n1));

angle1=a cos(−dot(n1,n2));

angle2=a cos(−dot(n2,n0));

where angle0 represents the included angle between the two normalvectors n0 and n1, angle1 represents the included angle between the twonormal vectors n1 and n2, and angle2 represents the included anglebetween the two normal vectors n2 and n0.

The terminal may determine, according to the included angles angle0,angle1 and angle2, the second solid angle of the light source gridrelative to the pixel. The second solid angle of the light source gridrelative to the pixel may be calculate by using the following formula:

SolidAngle=angle0+angle1+angle2−Pi;

-   -   where SolidAngle represents the second solid angle (that is β2)        of the light source grid relative to the pixel, and Pi        represents the ratio of the circumference of a circle to its        diameter.

In the embodiment, by determining the vector of each of the edges formedby the pixel and each of the vertexes of the light source grid, thenormal vector of each of the planes, where the pixel is located, of thepolygonal pyramid formed by the pixel and the vertexes of the lightsource grid can be determined according to the vector of each of theedges. According to the normal vector of each of the planes where thepixel is located, the second solid angle of the light source gridrelative to the pixel can be determined, and the accuracy of the directillumination contribution value can be improved by using the secondsolid angle as the direct illumination contribution value of the lightsource grid to the pixel in the project scene.

As shown in FIG. 10 , in an embodiment, an image rendering method isprovided. The method includes the following steps:

Step 1002: Acquire a project scene. Materials of an object in theproject scene includes a light source material. The light sourcematerial is a material that is endowed with a light source attribute bysetting a corresponding shading model to be a custom grid light sourceshading model.

Step 1004: Search object grids with the light source material from theproject scene, and perform light source structure conversion on theobject grids with the light source material, to obtain initial lightsource grids.

Step 1006: Determine the grid areas and the radiant illuminationinformation of the initial light source grids.

Step 1008: Determine, for each of the initial light source grids,luminous flux of the initial light source grid, according to the gridarea and the radiant illumination information of the initial lightsource grid.

Step 1010: Sample the initial light source grids according to theluminous flux of the initial light source grids, to obtain light sourcegrids.

Step 1012: Use each of the light source grids as a light source, anddetermine the radiant illumination information of the light source grid.

Step 1014: Sample, for each of the light source grids, points in thelight source grid according to a probability density distributionfunction, to obtain sampling points in the light source grid.

Step 1016: Determine, for each of the pixels of the image representingthe project scene, a first contribution coefficient of each of thesampling points relative to the pixel according to location informationcorresponding to each of the sampling points and location information ofa camera.

Step 1018: Determine, according to the included angle between incidentlight of each of the sampling points to the pixel and a normal of thepixel, a second contribution coefficient of each of the sampling pointsrelative to the pixel.

Step 1020: Determine, for each of the light source grids, the center ofgravity and the grid area of the light source grid.

Step 1022: Determine, for each of the pixels of the image representingthe project scene, a distance between the center of gravity of the lightsource grid and the pixel in the project scene.

Step 1024: Determine, based on the distance and the grid area of thelight source grid, a first solid angle of the light source grid relativeto the pixel.

Step 1026: Determine, according to the first solid angle, a probabilitydensity distribution function value for sampling each of the samplingpoints, and use the probability density distribution function value forsampling each of the sampling points as a third contribution coefficientof the sampling point relative to the pixel.

Step 1028: Determine, according to the first contribution coefficient,the second contribution coefficient and the third contributioncoefficient of each of the sampling points relative to the pixel, adirect illumination contribution value of the light source grid to thepixel in the project scene.

In an embodiment, for each of the pixels of the image representing theproject scene, a vector of each of the edges formed by the pixel andeach of the vertexes of the light source grid is determined. Accordingto the vector of each of the edges, a normal vector of each of theplanes, where the pixel is located, of a polygonal pyramid formed by thepixel and the vertexes of the light source grid is determined. Accordingto the normal vector of each of the planes where the pixel is located, asecond solid angle of the light source grid relative to the pixel isdetermined. The second solid angle is used as the direct illuminationcontribution value of the light source grid to the pixel in the projectscene.

Step 1030: Determine, according to the direct illumination contributionvalue and the radiant illumination information, a rendering illuminationvalue contributed by the light source grid to each of the pixels of theimage representing the project scene, and fuse the renderingillumination value of each of the light source grids to each of thepixels, to obtain a rendered target image.

The present disclosure further provides an implementation scene, theimage rendering method being applied to the present disclosure scene. Incertain embodiment(s), the image rendering method may be applied to agame image rendering scene. A terminal may acquire a gamescene-to-be-rendered. Materials of an object in the gamescene-to-be-rendered includes a light source material. The light sourcematerial is a material that is endowed with a light source attribute bysetting a corresponding shading model to be a custom grid light sourceshading model. Object grids with the light source material are searchedfrom the game scene-to-be-rendered, and light source structureconversion is performed on the object grids with the light sourcematerial, to obtain initial light source grids. The grid area and theradiant illumination information of the initial light source grids aredetermined. For each of the initial light source grids, luminous flux ofthe initial light source grid is determined according to the grid areaand the radiant illumination information of the initial light sourcegrid. The initial light source grids are sampled according to theluminous flux of the initial light source grids, to obtain light sourcegrids.

The terminal may use each of the light source grids as a light source,and determine the radiant illumination information of the light sourcegrid. For each of the light source grids, points in the light sourcegrid are sampled according to a probability density distributionfunction, to obtain sampling points in the light source grid. For eachof the pixels of an image representing the game scene-to-be-rendered, afirst contribution coefficient of each of the sampling points relativeto the pixel is determined according to location informationcorresponding to each of the sampling points and location information ofa camera. According to the included angle between incident light of eachof the sampling points to the pixel and a normal of the pixel, a secondcontribution coefficient of each of the sampling points relative to thepixel is determined. For each of the light source grids, the center ofgravity and the grid area of the light source grid are determined. Foreach of the pixels in the image representing the game scene, a distancebetween the center of gravity of the light source grid and the pixel inthe image is determined. Based on the distance and the grid area of thelight source grid, a first solid angle of the light source grid relativeto the pixel is determined. According to the first solid angle, aprobability density distribution function value for sampling each of thesampling points is determined, and the probability density distributionfunction value for sampling each of the sampling points is used as athird contribution coefficient of the sampling point relative to thepixel. According to the first contribution coefficient, the secondcontribution coefficient and the third contribution coefficient of eachof the sampling points relative to the pixel, a direct illuminationcontribution value of the light source grid to the pixel in the imagerepresenting the game scene is determined.

For each of the pixels in the image representing the game scene, theterminal may determine a vector of each of the edges formed by the pixeland each of the vertexes of the light source grid. According to thevector of each of the edges, a normal vector of each of the planes,where the pixel is located, of a polygonal pyramid formed by the pixeland the vertexes of the light source grid is determined. According tothe normal vector of each of the planes where the pixel is located, asecond solid angle of the light source grid relative to the pixel isdetermined. The second solid angle is used as the direct illuminationcontribution value of the light source grid to the pixel in the image.

The terminal may determine, according to the direct illuminationcontribution value and the radiant illumination information, a renderingillumination value contributed by the light source grid to each of thepixels of the image representing the game scene, and fuse the renderingillumination value of each of the light source grids to each of thepixels, to obtain a rendered target game image.

The present disclosure further additionally provides an implementationscene, the image rendering method being applied to the presentdisclosure scene. In certain embodiment(s), the image rendering methodmay be applied to an analog image rendering scene. A terminal may searchobject grids with a light source material from an analogimage-to-be-rendered, and perform light source structure conversion onthe object grids with the light source material to obtain light sourcegrids. Each of the light source grids is used as the light source, toperform direct illumination rendering on each of the pixels of the imagerepresenting the project scene, to obtain a rendered target analogimage.

It is to be understood that the present disclosure may be applied toscenes such as film and television special effects, visual design,virtual reality (VR), virtual targets, industrial simulation, anddigital cultural creation. The virtual targets may include at least oneof virtual characters, virtual animals and virtual objects. The digitalcultural creation may include rendered buildings or tourist attractions.It is to be understood that rendering of virtual images may be involvedin the scenes such as film and television special effects, visualdesign, VR, virtual targets, and digital cultural creation. Therendering of the virtual images in each of the scenes can be realized byusing the image rendering method of the present disclosure. In certainembodiment(s), the terminal may search the object grids with the lightsource material from the virtual scene-to-be-rendered, and perform lightsource structure conversion on the object grids with the light sourcematerial to obtain the light source grids. By using each of the lightsource grids as the light source, direct illumination rendering can beperformed on each of the pixels of an image representing the virtualscene-to-be-rendered. According to the image rendering method of thepresent disclosure, the rendering of the virtual scene is realized, andthe illumination rendering effect of the virtual object in the scene canbe improved, so that the noise of a finally rendered virtual image canbe reduced, and the virtual image quality can be improved.

For example, in a digital cultural creation rendering scene, therendering of buildings with cultural representative significance may beinvolved, such as the rendering of museums or historical buildings. Theobject grids with the light source material may be searched from adigital cultural creation scene-to-be-rendered, and converted into thelight source grids, and by using each of the light source grids as thelight source, direct illumination rendering can be performed on each ofthe pixels of an image representing the digital cultural creation scene,so as to improve the illumination rendering effect of rendering objectssuch as the buildings and get more realistic digital cultural andcreative buildings.

For another example, in an industrial simulation scene, simulationrendering of an industrial production environment may be involved, suchas a production workshop, an assembly line or production equipment of asimulation factory. Therefore, according to the image rendering methodof the present disclosure, the object grids with the light sourcematerial can be searched from an industrial simulation scene and convertinto the light source grids, and by using each of the light source gridsas the light source, direct illumination rendering can be directlyperformed on each of the pixels of an image representing the industrialsimulation scene, so that the illumination rendering effect of each ofthe rendering objects in the industrial simulation image can beimproved, and a more referential industrial production simulationenvironment can be obtained.

It is to be understood that, although the steps in a flowchart of eachof the embodiments are displayed sequentially, these steps are notnecessarily performed sequentially according to the sequence. Unlessotherwise explicitly specified in the present disclosure, execution ofthe steps is not strictly limited, and the steps may be performed inother sequences. Moreover, at least some of the steps in each of theembodiments may include a plurality of sub-steps or a plurality ofstages. The sub-steps or stages are not necessarily performed at thesame moment but may be performed at different moments. Execution of thesub-steps or stages is not necessarily sequentially performed, but maybe performed alternately with other steps or at least some of sub-stepsor stages of other steps.

In an embodiment, as shown in FIG. 11 , an image rendering apparatus1100 is provided. The apparatus may adopt a software module or ahardware module, or a combination of the two to become a part of acomputing device. The apparatus includes:

-   -   an acquiring module 1102, configured to acquire a project scene,        materials of an object in the project scene including a light        source material, and the light source material being a material        that is endowed with a light source attribute by setting a        corresponding shading model to be a custom grid light source        shading model.    -   a search module 1104, configured to search object grids with the        light source material from the project scene, and perform light        source structure conversion on the object grids with the light        source material to obtain light source grids, the object grids        being grids used for forming the grid of the object in the        project scene; and    -   a rendering module 1106, configured to use each of the light        source grids as a light source, to perform direct illumination        rendering on each of the pixels of the image representing the        project scene, and fuse a direct illumination rendering result        of each of the light source grids for each of the pixels to        obtain a rendered target image.

In an embodiment, the same object in the project scene includes aplurality of grid regions of the same material. The grid regions of thesame material are regions which are composed of a plurality of adjacentobject grids of the same material in the same object. The search module1104 is further configured to search the grid regions of the samematerial with the light source attribute from the grid regions of thesame material in the project scene, to obtain self-luminous grid regionsof the same material, each of the object grids included in theself-luminous grid regions of the same material being the object grid ofthe light source material; and perform light source structure conversionon the object grids of the light source material in the self-luminousgrid region of the same material, to obtain the light source grids.

In an embodiment, the search module 1104 is further configured toacquire, for each of the self-luminous grid regions of the samematerial, a calculation scheduling instruction corresponding to theself-luminous grid region of the same material; and enable a calculationshader according to the calculation scheduling instruction, to execute aplurality of threads in the calculation shader, and perform light sourcestructure conversion in parallel on the object grids of the light sourcematerial in the self-luminous grid region of the same material, toobtain the light source grids.

In an embodiment, the search module 1104 is further configured to enablea calculation shader according to a calculation scheduling instruction,so that the calculation shader enables threads of which the quantity isthe same as the quantity of the object grids in the self-luminous gridregion of the same material; and perform light source structureconversion in parallel on the object grids of the light source materialin the self-luminous grid region of the same material through theenabled threads, of which the quantity is the same as the quantity ofthe object grids in the self-luminous grid region of the same material,to obtain the light source grids. Each of the object grids in theself-luminous grid region of the same material corresponds to onethread.

In an embodiment, the rendering module 1106 is further configured to useeach of the light source grids as the light source, and determine theradiant illumination information of the light source grid; and perform,based on the radiant illumination information of each of the lightsource grids, direct illumination rendering on each of the pixels of theimage representing the project scene.

In an embodiment, the radiant illumination information includes aradiant color value. The rendering module 1106 is further configured to,in response to that the light source grid is a solid color light sourcegrid, use a self-luminous color value corresponding to the solid colorlight source grid as the radiant color value of the solid color lightsource grid, the self-luminous color value being a color value preset ina grid light source shading model corresponding to the solid color lightsource grid.

In an embodiment, the radiant illumination information includes aradiant color value. The rendering module 1106 is further configured to,in response to that the light source grid is a texture light sourcegrid, determine an average color value of texture colors in the texturelight source grid, to obtain the radiant color value of the texturelight source grid.

In an embodiment, the rendering module 1106 is further configured to, inresponse to that the light source grid is a texture light sourcetriangular grid, determine the length of each of edges in the texturelight source triangular grid; determine the length of the shortest edgein the texture light source triangular grid, and determine a firsttexture information change rate of the texture light source triangulargrid in a texture space; determine, according to the correspondinglengths of the two long edges of the texture light source triangulargrid, a second texture information change rate of the texture lightsource triangular grid in the texture space; the two long edges beingtwo edges except the shortest edge of the texture light sourcetriangular grid; and determine, according to the first textureinformation change rate and the second texture information change ratecorresponding to the texture light source triangular grid, the averagecolor value of the texture colors in the texture light source triangulargrid, to obtain the radiant color value of the texture light sourcetriangular grid.

In an embodiment, the rendering module 1106 is further configured to usethe first texture information change rate and the second textureinformation change rate corresponding to the texture light sourcetriangular grid as parameters of a level determination function, toobtain a corresponding level of texture mapping; and use a texture colorvalue corresponding to the level of texture mapping as the average colorvalue of the texture colors in the texture light source triangular grid,to obtain the radiant color value of the texture light source triangulargrid, The level determination function is a function that is pre-builtand used for determining the level of texture mapping.

In an embodiment, the search module 1104 is further configured toperform light source structure conversion on the object grids of thelight source material to obtain initial light source grids; determinethe grid areas and the radiant illumination information of the initiallight source grids; determine, for each of the initial light sourcegrids, luminous flux of the initial light source grid, according to thegrid area and the radiant illumination information of the initial lightsource grid; and sample, according to the luminous flux of the initiallight source grids, the initial light source grids to obtain the lightsource grids.

In an embodiment, the rendering module 1106 is further configured todetermine, for each of the light source grids, a direct illuminationcontribution value of the light source grid to each of the pixels of theimage representing the project scene; determine, according to the directillumination contribution value and the radiant illuminationinformation, a rendering illumination value contributed by the lightsource grid to each of the pixels of the image representing the projectscene. fuse the rendering illumination value of each of the light sourcegrids for each of the pixels, to obtain the rendered target image.

In an embodiment, the rendering module 1106 is further configured tosample, for each of the light source grids, points in the light sourcegrid according to a probability density distribution function, to obtainsampling points in the light source grid; determine, for each of thepixels of the image representing the project scene, a first contributioncoefficient of each of the sampling points relative to the pixelaccording to location information corresponding to each of the samplingpoints and location information of a camera; determine, according to theincluded angle between incident light of each of the sampling points tothe pixel and a normal of the pixel, a second contribution coefficientof each of the sampling points relative to the pixel; determine,according to a probability density distribution function value forsampling each of the sampling points, a third contribution coefficientof each of the sampling points relative to the pixel; and determine,according to the first contribution coefficient, the second contributioncoefficient and the third contribution coefficient of each of thesampling points relative to the pixel, the direct illuminationcontribution value of the light source grid to the pixel in the projectscene.

In an embodiment, the rendering module 1106 is further configured todetermine, for each of the light source grids, the center of gravity andthe grid area of the light source grid; determine, for each of thepixels of the image representing the project scene, a distance betweenthe center of gravity of the light source grid and the pixel in theproject scene; determine, based on the distance and the grid area of thelight source grid, a first solid angle of the light source grid relativeto the pixel; and determine, according to the first solid angle, aprobability density distribution function value for sampling each of thesampling points, and use the probability density distribution functionvalue for sampling each of the sampling points as the third contributioncoefficient of the sampling point relative to the pixel.

In an embodiment, the rendering module 1106 is further configured todetermine, for each of the pixels of the image representing the projectscene, a vector of each of the edges formed by the pixel and each of thevertexes of the light source grid; determine, according to the vector ofeach of the edges, a normal vector of each of the planes, where thepixel is located, of a polygonal pyramid formed by the pixel and thevertexes of the light source grid; determine, according to the normalvector of each of the planes where the pixel is located, a second solidangle of the light source grid relative to the pixel; and use the secondsolid angle as the direct illumination contribution value of the lightsource grid to the pixel in the project scene.

The image rendering apparatus acquires the project scene. The materialsof the object in the project scene include the light source material,the light source material being the material that is endowed with thelight source attribute by setting the corresponding shading model to bethe custom grid light source shading model. By searching the objectgrids with the light source material from the project scene, andperforming light source structure conversion on the object grids withthe light source material, the light source grids that can be directlyused as the light sources can be obtained. By using each of the lightsource grids as the light source, direct illumination rendering can beperformed on each of the pixels of the image representing the projectscene; and by fusing the direct illumination rendering result of each ofthe light source grids for each of the pixels, the rendered target imagecan be obtained. By directly using the light source grid obtainedthrough light source structure conversion as the light source to performdirect illumination rendering on each of the pixels of the imagerepresenting the project scene, the illumination rendering effect of theobject in the scene can be improved, so that the noise of the finallyrendered target image can be reduced, and the image quality can beimproved.

Each module in the image rendering apparatus may be implemented entirelyor partially through software, hardware, or a combination thereof. Themodules may be embedded in or independent of a processor in a computingdevice in the form of hardware, and may also be stored in a memory ofthe computing device in the form of software, so as to facilitate theprocessor to call and execute operations corresponding to the modules.

In an embodiment, a computing device is provided. The computing devicemay be a terminal, and an internal structure diagram thereof may beshown in FIG. 12 . The computing device includes a processor, a memory,an input/output interface, a communication interface, a display unit andan input apparatus. The processor, the memory and the input/outputinterface are connected through a system bus, and the communicationinterface, the display unit and the input apparatus are connected to thesystem bus through the input/output interface. The processor of thecomputing device is configured to provide computation and controlability. The memory of the computing device includes a non-volatilestorage medium and an internal memory. The non-volatile storage mediumstores an operating system and computer-readable instructions. Theinternal memory provides an operating environment for the operatingsystem and the computer-readable instructions in the non-volatilestorage medium. The input/output interface of the computing device isused for exchanging information between the processor and an externaldevice. The communication interface of the computing device is used forcommunicating with external terminals in a wired or wireless mode, andthe wireless mode may be realized by WIFI, mobile cellular network, nearfield communication (NFC) or other technologies. The computer-readableinstructions are executed to implement an image rendering method. Thedisplay unit of the computing device is used for forming visuallyavailable images, and may be a display screen, a projection apparatus ora virtual reality imaging apparatus. The display screen may be a liquidcrystal display screen or an e-ink display screen. The input apparatusof the computing device may be a touch layer covering the displayscreen, or may be a button, a trackball, or a touch pad disposed on ahousing of the computing device, or may be an external keyboard, touchpad, a mouse or the like.

A person skilled in the art may understand that, the structure shown inFIG. 12 is merely a block diagram of a partial structure related to asolution in the present disclosure, and does not constitute a limitationto the computing device to which the solution in the present disclosureis applied. In certain embodiment(s), the computing device may includemore components or fewer components than those shown in the figure, orsome components may be combined, or a different component deployment maybe used.

In an embodiment, a computing device is further provided, including: amemory and one or more processors, the memory storing computer-readableinstructions, and when executing the computer-readable instructions, theprocessor implementing the steps in the method embodiments.

In an embodiment, one or more computer-readable storage media areprovided, in which computer-readable instructions are stored, thecomputer-readable instruction instructions, when executed by aprocessor, implementing steps in the method embodiments.

In an embodiment, a computer program product is further provided,including computer-readable instructions, the computer-readableinstruction instructions, when executed by a processor, implementingsteps in the method embodiments.

User information (including but not limited to user device information,user personal information, etc.) and data (including but not limited todata for analysis, stored data, displayed data, etc.) involved in thepresent disclosure are all information and data authorized by users orauthorized by all parties, and the collection, use and processing ofrelevant data are to comply with relevant laws, regulations andstandards of relevant countries and regions.

An ordinary person skilled in the art may understand that all or some ofprocedures of the methods in the embodiments may be implemented bycomputer-readable instructions instructing relevant hardware. Thecomputer-readable instructions may be stored in a non-volatilecomputer-readable storage medium. When the computer-readableinstructions are executed, the procedures of the method embodiments maybe included. References to the memory, the storage, the database, orother medium used in the embodiments provided in the present disclosuremay all include at least one of a non-volatile memory or a volatilememory. The non-volatile memory may be a read-only memory (ROM), amagnetic tape, a floppy disk, a flash memory or an optical memory, etc.The volatile memory may be a random access memory (RAM) or an externalcache memory. As an illustration rather than a limitation, RAM may be invarious forms, such as a static random access memory (SRAM) or a dynamicrandom access memory (DRAM).

The term unit (and other similar terms such as subunit, module,submodule, etc.) in this disclosure may refer to a software unit, ahardware unit, or a combination thereof. A software unit (e.g., computerprogram) may be developed using a computer programming language. Ahardware unit may be implemented using processing circuitry and/ormemory. Each unit may be implemented using one or more processors (orprocessors and memory). Likewise, a processor (or processors and memory)may be used to implement one or more units. Moreover, each unit may bepart of an overall unit that includes the functionalities of the unit.

Technical features of the embodiments may be randomly combined. To makedescription concise, not all possible combinations of the technicalfeatures in the embodiments are described. However, the combinations ofthese technical features shall be considered as falling within the scoperecorded by the present disclosure provided that no conflict exists.

The embodiments only describe several implementations of the presentdisclosure, which are described and in detail, but cannot be construedas a limitation to the patent scope of the present disclosure. For anordinary person skilled in the art, several transformations andimprovements can be made without departing from the idea of. The presentdisclosure. These transformations and improvements belong to theprotection scope of. The present disclosure. Therefore, the protectionscope of the patent of the present disclosure shall be subject to theappended claims.

What is claimed is:
 1. An image rendering method, executed by aterminal, the method comprising: acquiring a project scene, materials ofan object in the project scene including a light source material, andthe light source material being a material that is endowed with a lightsource attribute by setting a corresponding shading model to be a customgrid light source shading model; searching object grids with the lightsource material from the project scene, and performing light sourcestructure conversion on the object grids with the light source materialto obtain light source grids, the object grids being grids used forforming the object in the project scene; and using each of the lightsource grids as a light source, to perform direct illumination renderingon each of pixels of an image representing the project scene, and fusinga direct illumination rendering result of each of the light source gridsfor each of the pixels to obtain a rendered target image.
 2. The methodaccording to claim 1, wherein a same object in the project sceneincludes a plurality of grid regions of a same material, the gridregions of the same material are regions including a plurality ofadjacent object grids of the same material in the same object, andsearching the object grids comprises: searching, from the grid regionsof the same material in the project scene, the grid regions of the samematerial with the light source attribute, to obtain self-luminous gridregions of the same material, each of the object grids included in theself-luminous grid regions of the same material being the object grid ofthe light source material; and performing light source structureconversion on the object grids of the light source material in theself-luminous grid region of the same material, to obtain the lightsource grids.
 3. The method according to claim 2, wherein performing thelight source structure conversion comprises: acquiring, for each of theself-luminous grid regions of the same material, a calculationscheduling instruction corresponding to the self-luminous grid region ofthe same material; and enabling a calculation shader according to thecalculation scheduling instruction, to execute a plurality of threads inthe calculation shader, and performing light source structure conversionin parallel on the object grids of the light source material in theself-luminous grid region of the same material, to obtain the lightsource grids.
 4. The method according to claim 3, wherein enabling thecalculation shader comprises: enabling the calculation shader accordingto the calculation scheduling instruction, so that the calculationshader enables the threads of which the quantity is the same as thequantity of the object grids in the self-luminous grid region of thesame material; and performing light source structure conversion inparallel on the object grids of the light source material in theself-luminous grid region of the same material through the enabledthreads, of which the quantity is the same as the quantity of the objectgrids in the self-luminous grid region of the same material, to obtainthe light source grids, each of the object grids in the self-luminousgrid region of the same material corresponding to one thread.
 5. Themethod according to claim 1, wherein using the each of the light sourcegrids as the light source comprises: using each of the light sourcegrids as the light source, and determining radiant illuminationinformation of the light source grid; and performing, based on theradiant illumination information of each of the light source grids,direct illumination rendering on each of the pixels of the imagerepresenting the project scene.
 6. The method according to claim 5,wherein the radiant illumination information includes a radiant colorvalue; and determining radiant illumination information of the lightsource grid comprises: in response to that the light source grid is asolid color light source grid, using a self-luminous color valuecorresponding to the solid color light source grid as the radiant colorvalue of the solid color light source grid, the self-luminous colorvalue being a color value preset in a grid light source shading modelcorresponding to the solid color light source grid.
 7. The methodaccording to claim 5, wherein the radiant illumination informationincludes a radiant color value; and determining the radiant illuminationinformation of the light source grid comprises: in response to that thelight source grid is a texture light source grid, determining an averagecolor value of texture colors in the texture light source grid, toobtain the radiant color value of the texture light source grid.
 8. Themethod according to claim 7, wherein determining the average color valueof texture colors comprises: in response to that the light source gridis a texture light source triangular grid, determining the length ofeach of edges in the texture light source triangular grid; determiningthe length of the shortest edge of the texture light source triangulargrid, and determining a first texture information change rate of thetexture light source triangular grid in a texture space; determining,according to the corresponding lengths of two long edges of the texturelight source triangular grid, a second texture information change rateof the texture light source triangular grid in the texture space, thetwo long edges being two edges except the shortest edge of the texturelight source triangular grid; and determining, according to the firsttexture information change rate and the second texture informationchange rate corresponding to the texture light source triangular grid,the average color value of the texture colors in the texture lightsource triangular grid, to obtain the radiant color value of the texturelight source triangular grid.
 9. The method according to claim 8,wherein determining the average color value of the texture colorscomprises: using the first texture information change rate and thesecond texture information change rate corresponding to the texturelight source triangular grid as parameters of a level determinationfunction, to obtain a corresponding level of texture mapping; using atexture color value corresponding to the level of the texture mapping asthe average color value of the texture colors in the texture lightsource triangular grid, to obtain the radiant color value of the texturelight source triangular grid, the level determination function being afunction that is pre-built and used for determining the level of thetexture mapping.
 10. The method according to claim 5, wherein performingthe direct illumination rendering comprises: determining, for each ofthe light source grids, a direct illumination contribution value of thelight source grid to each of the pixels of the image representing theproject scene; and determining, according to the direct illuminationcontribution value and the radiant illumination information, a renderingillumination value contributed by the light source grid to each of thepixels of the image representing the project scene; and fusing thedirect illumination rendering result comprises: fusing the renderingillumination value of each of the light source grids for each of thepixels, to obtain the rendered target image.
 11. The method according toclaim 10, wherein determining the direct illumination contribution valueof the light source grid comprises: sampling, for each of the lightsource grids, points in the light source grid according to a probabilitydensity distribution function, to obtain sampling points in the lightsource grid; determining, for each of the pixels of the imagerepresenting the project scene, a first contribution coefficient of eachof the sampling points relative to the pixel according to locationinformation corresponding to each of the sampling points and locationinformation of a camera; determining, according to the included anglebetween incident light of each of the sampling points to the pixel and anormal of the pixel, a second contribution coefficient of each of thesampling points relative to the pixel; determining, according to aprobability density distribution function value for sampling each of thesampling points, a third contribution coefficient of each of thesampling points relative to the pixel; and determining, according to thefirst contribution coefficient, the second contribution coefficient andthe third contribution coefficient of each of the sampling pointsrelative to the pixel, the direct illumination contribution value of thelight source grid to the pixel in the project scene.
 12. The methodaccording to claim 11, wherein determining the third contributioncoefficient comprises: determining, for each of the light source grids,the center of gravity and the grid area of the light source grid;determining, for each of the pixels of the image representing theproject scene, a distance between the center of gravity of the lightsource grid and the pixel in the project scene; determining, based onthe distance and the grid area of the light source grid, a first solidangle of the light source grid relative to the pixel; and determining,according to the first solid angle, a probability density distributionfunction value for sampling each of the sampling points, and using theprobability density distribution function value for sampling each of thesampling points as the third contribution coefficient of the samplingpoint relative to the pixel.
 13. The method according to claim 10,wherein determining the direct illumination contribution valuecomprises: determining, for each of the pixels of the image representingthe project scene, a vector of each of edges formed by the pixel andeach of vertexes of the light source grid; determining, according to thevector of each of the edges, a normal vector of each of planes, wherethe pixel is located, of a polygonal pyramid formed by the pixel and thevertexes of the light source grid; determining, according to the normalvector of each of the planes where the pixel is located, a second solidangle of the light source grid relative to the pixel; and using thesecond solid angle as the direct illumination contribution value of thelight source grid to the pixel in the project scene.
 14. The methodaccording to claim 1, wherein performing the light source structureconversion comprises: performing light source structure conversion onthe object grids of the light source material, to obtain initial lightsource grids; determining the grid areas and the radiant illuminationinformation of the initial light source grids; determining, for each ofthe initial light source grids, luminous flux of the initial lightsource grid, according to the grid area and the radiant illuminationinformation of the initial light source grid; and sampling, according tothe luminous flux of the initial light source grids, the initial lightsource grids to obtain the light source grids.
 15. An image renderingapparatus, the apparatus comprising: a memory storing computer programinstructions; and a processor coupled to the memory and configured toexecute the computer program instructions and perform: acquiring aproject scene, materials of an object in the project scene including alight source material, and the light source material being a materialthat is endowed with a light source attribute by setting a correspondingshading model to be a custom grid light source shading model; searchingobject grids with the light source material from the project scene, andperforming light source structure conversion on the object grids withthe light source material to obtain light source grids, the object gridsbeing grids used for forming the object in the project scene; and usingeach of the light source grids as a light source, to perform directillumination rendering on each of pixels of an image representing theproject scene, and fusing a direct illumination rendering result of eachof the light source grids for each of the pixels to obtain a renderedtarget image.
 16. The apparatus according to claim 15, wherein a sameobject in the project scene includes a plurality of grid regions of asame material, the grid regions of the same material are regionsincluding a plurality of adjacent object grids of the same material inthe same object, and searching the object grids includes: searching,from the grid regions of the same material in the project scene, thegrid regions of the same material with the light source attribute, toobtain self-luminous grid regions of the same material, each of theobject grids included in the self-luminous grid regions of the samematerial being the object grid of the light source material; andperforming light source structure conversion on the object grids of thelight source material in the self-luminous grid region of the samematerial, to obtain the light source grids.
 17. The apparatus accordingto claim 16, wherein performing the light source structure conversionincludes: acquiring, for each of the self-luminous grid regions of thesame material, a calculation scheduling instruction corresponding to theself-luminous grid region of the same material; and enabling acalculation shader according to the calculation scheduling instruction,to execute a plurality of threads in the calculation shader, andperforming light source structure conversion in parallel on the objectgrids of the light source material in the self-luminous grid region ofthe same material, to obtain the light source grids.
 18. The apparatusaccording to claim 15, wherein using the each of the light source gridsas the light source includes: using each of the light source grids asthe light source, and determining radiant illumination information ofthe light source grid; and performing, based on the radiant illuminationinformation of each of the light source grids, direct illuminationrendering on each of the pixels of the image representing the projectscene.
 19. The apparatus according to claim 15, wherein performing thelight source structure conversion includes: performing light sourcestructure conversion on the object grids of the light source material,to obtain initial light source grids; determining the grid areas and theradiant illumination information of the initial light source grids;determining, for each of the initial light source grids, luminous fluxof the initial light source grid, according to the grid area and theradiant illumination information of the initial light source grid; andsampling, according to the luminous flux of the initial light sourcegrids, the initial light source grids to obtain the light source grids.20. A non-transitory computer-readable storage medium storing computerprogram instructions executable by at least one processor to perform:acquiring a project scene, materials of an object in the project sceneincluding a light source material, and the light source material being amaterial that is endowed with a light source attribute by setting acorresponding shading model to be a custom grid light source shadingmodel; searching object grids with the light source material from theproject scene, and performing light source structure conversion on theobject grids with the light source material to obtain light sourcegrids, the object grids being grids used for forming the object in theproject scene; and using each of the light source grids as a lightsource, to perform direct illumination rendering on each of pixels ofthe image representing the project scene, and fusing a directillumination rendering result of each of the light source grids for eachof the pixels to obtain a rendered target image.